<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function passwordNum() {
        var num = prompt("请输入要加密的文字");
        var end = [];
        var pasNum = [];
        if (num % 1 == 0) {
          // console.log("整数");
          for (var i = 0; i < num.length; i++) {
            end.push((+num[i] + 5) % 10);
          }

          return end.reverse().join("");
          // console.log(end);
        } else {
          console.log("请输入整数");
        }
      }
      console.log(passwordNum());
    </script>
  </body>
</html>
